from django import forms
from studenthoods.apps.common import widgets

class FeedbackForm(forms.Form):
    first_name = forms.CharField(max_length=15, label="First name")
    surname = forms.CharField(max_length=15, label="Surname")
    email = forms.EmailField(max_length=40, label="Email address", widget=widgets.MyEmailInput)
    comment = forms.CharField(label="Comment", widget=forms.Textarea())
    
    def __init__(self, *args, **kwargs):
        super(FeedbackForm, self).__init__(*args, **kwargs)

        extra_errors = {
            'first_name':{'required':'Please enter your First name'},
            'surname':{'required':'Please enter your Surname'},
            'email':{'required':'Please enter your Email address'},
            'comment':{'required':'Please enter your Comment'},
        }

        
        for field, errors in extra_errors.iteritems():
            self.fields[field].error_messages.update(errors)